using System;
using System.Globalization;
using System.Windows.Data;

namespace WPFServices.Converters
{
    public class WorkOrderStatusConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is int status)
            {
                return status switch
                {
                    0 => "未开始",
                    1 => "进行中",
                    2 => "已完成",
                    3 => "已暂停",
                    4 => "已取消",
                    _ => "未知状态"
                };
            }
            return "未知状态";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    public class WorkOrderStatusColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is int status)
            {
                return status switch
                {
                    0 => "#FFA500", // 橙色 - 未开始
                    1 => "#4CAF50", // 绿色 - 进行中
                    2 => "#2196F3", // 蓝色 - 已完成
                    3 => "#FF9800", // 橙色 - 已暂停
                    4 => "#F44336", // 红色 - 已取消
                    _ => "#757575"  // 灰色 - 未知状态
                };
            }
            return "#757575";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
} 